package com.serviceprovider.business.module.sp.transaction.model;

//~--- JDK imports ------------------------------------------------------------

import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author mrduongnv@gmail.com
 *
 */
public class TransactionDetail /* implements Comparable<TransactionDetail> */ {
    public static List<String> FEE_COLUMN_NAMES = Arrays.asList("self_fee", "tax_prep_fee", "electronic_prep_fee",
                                                      "electronic_filling_fee", "service_bureau_fee",
                                                      "fed_bank_product_fee", "state_product_fee");
    private Integer           amount = 0;
    private Batch             batch;
    private Integer           customLabel1;
    private Integer           customLabel2;
    private Integer           customerBalance;
    private String            customerName;
    private Integer           customerSSN;
    Date                      dataLoadDate;
    private Integer           electronicFillingFee;
    private Integer           electronicPrepFee;
    private Integer           fedBankProductFee;
    private Integer           id;
    private String            originatorName;
    private Integer           selfFee;
    private Integer           serviceBureauFee;
    private Integer           serviceFee;
    private Integer           stateProductFee;
    private Integer           taxPrepFee;
    private String            traceNumber;
    private TransactionStatus transactionStatus;

    /**
     * Lazy attribute
     */
    private List<TransactionUserAmount> transactionUserAmount;
    private Integer                     userId;

    public TransactionDetail() {}

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Batch getBatch() {
        return batch;
    }

    public void setBatch(Batch batch) {
        this.batch = batch;
    }

    public String getTraceNumber() {
        return traceNumber;
    }

    public void setTraceNumber(String traceNumber) {
        this.traceNumber = traceNumber;
    }

    public TransactionStatus getTransactionStatus() {
        return transactionStatus;
    }

    public void setTransactionStatus(TransactionStatus transactionStatus) {
        this.transactionStatus = transactionStatus;
    }

    public Integer getAmount() {
        return amount;
    }

    public void setAmount(Integer amount) {
        this.amount = amount;
    }

    public String getCustomerName() {
        return customerName;
    }

    public void setCustomerName(String customerName) {
        this.customerName = customerName;
    }

    public String getOriginatorName() {
        return originatorName;
    }

    public void setOriginatorName(String originatorName) {
        this.originatorName = originatorName;
    }

    public Integer getCustomerSSN() {
        return customerSSN;
    }

    public void setCustomerSSN(Integer customerSSN) {
        this.customerSSN = customerSSN;
    }

    public Integer getSelfFee() {
        return selfFee;
    }

    public void setSelfFee(Integer selfFee) {
        this.selfFee = selfFee;
    }

    public Integer getTaxPrepFee() {
        return taxPrepFee;
    }

    public void setTaxPrepFee(Integer taxPrepFee) {
        this.taxPrepFee = taxPrepFee;
    }

    public Integer getElectronicPrepFee() {
        return electronicPrepFee;
    }

    public void setElectronicPrepFee(Integer electronicPrepFee) {
        this.electronicPrepFee = electronicPrepFee;
    }

    public Integer getElectronicFillingFee() {
        return electronicFillingFee;
    }

    public void setElectronicFillingFee(Integer electronicFillingFee) {
        this.electronicFillingFee = electronicFillingFee;
    }

    public Integer getServiceBureauFee() {
        return serviceBureauFee;
    }

    public void setServiceBureauFee(Integer serviceBureauFee) {
        this.serviceBureauFee = serviceBureauFee;
    }

    public Integer getFedBankProductFee() {
        return fedBankProductFee;
    }

    public void setFedBankProductFee(Integer fedBankProductFee) {
        this.fedBankProductFee = fedBankProductFee;
    }

    public Integer getStateProductFee() {
        return stateProductFee;
    }

    public void setStateProductFee(Integer stateProductFee) {
        this.stateProductFee = stateProductFee;
    }

    public Integer getServiceFee() {
        return serviceFee;
    }

    public void setServiceFee(Integer serviceFee) {
        this.serviceFee = serviceFee;
    }

    public Integer getCustomLabel1() {
        return customLabel1;
    }

    public void setCustomLabel1(Integer customLabel1) {
        this.customLabel1 = customLabel1;
    }

    public Integer getCustomLabel2() {
        return customLabel2;
    }

    public void setCustomLabel2(Integer customLabel2) {
        this.customLabel2 = customLabel2;
    }

    public Integer getCustomerBalance() {
        return customerBalance;
    }

    public void setCustomerBalance(Integer customerBalance) {
        this.customerBalance = customerBalance;
    }

    public Date getDataLoadDate() {
        return dataLoadDate;
    }

    public void setDataLoadDate(Date dataLoadDate) {
        this.dataLoadDate = dataLoadDate;
    }

    public Map<String, Integer> getFees() {
        Map<String, Integer> fees = new HashMap<String, Integer>();

        fees.put("self_fee", getSelfFee());
        fees.put("tax_prep_fee", getTaxPrepFee());
        fees.put("electronic_prep_fee", getElectronicPrepFee());
        fees.put("electronic_filling_fee", getElectronicFillingFee());
        fees.put("service_bureau_fee", getServiceBureauFee());
        fees.put("fed_bank_product_fee", getFedBankProductFee());
        fees.put("state_product_fee", getStateProductFee());

        return fees;
    }

    public void setTransactionUserAmounts(List<TransactionUserAmount> transAmount) {
        this.transactionUserAmount = transAmount;
    }

    public List<TransactionUserAmount> getTransactionUserAmount() {
        return transactionUserAmount;
    }

    @Override
    public boolean equals(Object obj) {
        if ((obj == null) ||!(obj instanceof TransactionDetail)) {
            return false;
        }

        TransactionDetail b = (TransactionDetail) obj;

        return ((id == null) && (b.id == null)) || ((id != null) && id.equals(b.id));
    }

    @Override
    public int hashCode() {
        return (id != null)
               ? id.hashCode()
               : 0;
    }

    /*
     * @Override
     * public int compareTo(TransactionDetail o) {
     *       return this.customerName.compareTo(o.customerName);
     * }
     */
}



